cd /Users/hollingsworth.126/Documents/ap3-carbonate-double-check
clear all

Population = csvread('pop_1997_prime_aged.csv');

Mortality = csvread('mort_1997.csv');

WTP_Mort = 9626754.41; 

DoseResponseAdult = 0.005826891; % Krewski

One = ones(19,1);

DeathsNoPM = (Mortality.*Population);
DeathsNoPMcounty = sum(DeathsNoPM, 2);


% Danger from 1 unit of PM
PM_25 = ones(3109,1);
PM_25DR = (1-(1./(exp(DoseResponseAdult.*PM_25')))); 

fplot(@(x) .06*(1-(1/(exp(0.005826891*x)))),[0 20],'Linewidth',2)
hold on 
fplot(@(x) .03*(1-(1/(exp(0.005826891*x)))),[0 20],'--or')
fplot(@(x) .015*(1-(1/(exp(0.005826891*x)))),[0 20],'-.*c')
hold off

    % This shifts the underlying mortality rate by x% in each cell
PM_25RD_19 = (One*PM_25DR)';

DeathsPM = (Mortality.*PM_25RD_19.*Population);


% Viscusi Aldy REEP
adult_mort_damages_county = sum(DeathsNoPM.*WTP_Mort, 2);
Mort = sum(sum(DeathsNoPM.*WTP_Mort));
